package com.ticket.system.mapper;

import java.util.List;

import com.ticket.system.domain.YanchuOrderDetail;
import com.ticket.system.domain.vo.ExcelOrderDetailVo;
import com.ticket.system.domain.vo.OrderDetailVo;
import com.ticket.system.domain.vo.TicketCountStatVo;
import com.ticket.system.domain.vo.WatchRecordVo;
import org.apache.ibatis.annotations.Param;

/**
 * 订单详情Mapper接口
 *
 * @author ruoyi
 * @date 2023-09-26
 */
public interface YanchuOrderDetailMapper {
    /**
     * 查询订单详情
     *
     * @param id 订单详情主键
     * @return 订单详情
     */
    public YanchuOrderDetail selectYanchuOrderDetailById(Long id);

    public YanchuOrderDetail selectOrderDetailByTicketNo(String ticketNo);

    public YanchuOrderDetail selectOrderDetailVoById(Long id);

    /**
     * 查询订单详情列表
     *
     * @param yanchuOrderDetail 订单详情
     * @return 订单详情集合
     */
    public List<YanchuOrderDetail> selectYanchuOrderDetailList(YanchuOrderDetail yanchuOrderDetail);

    public List<YanchuOrderDetail> selectPayedOrderDetailList(@Param("orderId")Long orderId);

    public List<TicketCountStatVo> selectOrderDetailStat(@Param("list")List<Long> list);

    public List<OrderDetailVo> selectOrderDetailVoList(@Param("sessionId")Long sessionId,@Param("status")Integer status,
                                                       @Param("userName")String userName,@Param("orderId")Long orderId);

    public List<OrderDetailVo> selectOrderDetailCancelVoList(@Param("sessionId")Long sessionId,@Param("status")Integer status,
                                                             @Param("userName")String userName);

    public List<OrderDetailVo> selectRefundDetailVoList(@Param("refundId")Long refundId);

    public List<OrderDetailVo> selectDetailVoListByRefund(@Param("refundId")Long refundId);

    /**
     * 新增订单详情
     *
     * @param yanchuOrderDetail 订单详情
     * @return 结果
     */
    public int insertYanchuOrderDetail(YanchuOrderDetail yanchuOrderDetail);

    public int insertBatchDetail(List<YanchuOrderDetail> list);

    public int insertBatchCheck(@Param("idNums")List<String> idNums,@Param("sessionId")Long sessionId);

    /**
     * 修改订单详情
     *
     * @param yanchuOrderDetail 订单详情
     * @return 结果
     */
    public int updateYanchuOrderDetail(YanchuOrderDetail yanchuOrderDetail);

    public int updateById(@Param("id") Long id, @Param("checkedUserId") Long checkedUserId, @Param("status") Integer status,
                          @Param("oldStatus") Integer oldStatus);
    public int updateByOrderId(@Param("orderId") Long orderId, @Param("checkedUserId") Long checkedUserId, @Param("status") Integer status,
                          @Param("oldStatus") Integer oldStatus);

    /**
     * 删除订单详情
     *
     * @param id 订单详情主键
     * @return 结果
     */
    public int deleteYanchuOrderDetailById(Long id);

    /**
     * 批量删除订单详情
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteYanchuOrderDetailByIds(@Param("array")Long[] ids);

    public List<YanchuOrderDetail> selectOrderDetails(@Param("array")List<Long> ids);

    /**
     * 查询组合票区域id
     * @param ids
     * @return
     */
    public List<Long> selectAreIds(@Param("array")List<Long> ids);

    public List<YanchuOrderDetail> selectOrderDetailsByAreaId(@Param("array") List<Long> ids,@Param("orderId")Long orderId);

    public YanchuOrderDetail selectOrderDetailByUserId(@Param("userId") Long userId, @Param("id") Long id);

    public int updateOrderDetailByNo(@Param("orderId") Long orderId, @Param("status") Integer status,
                                     @Param("oldStatus") Integer oldStatus);
    public int updateOrderDetailById(@Param("ids") List<Long> ids, @Param("status") Integer status,
                          @Param("oldStatus") Integer oldStatus);

    public int updateOrderDetailByRefundNo(@Param("orderId") Long orderId, @Param("refundId") Long refundId,@Param("status") Integer status,
                                     @Param("oldStatus") Integer oldStatus);
    /**
     * 根据订单id查询订单详情
     *
     * @param orderId 订单id
     * @return
     */
    public List<OrderDetailVo> selectOrderDetailByOrderId(@Param("orderId") Long orderId);

    /**
     * 根据订单id并按票价统计购票数量
     *
     * @param orderId 订单id
     * @return
     */
    public List<OrderDetailVo> statisticsBuyTicketNumberByMoney(@Param("orderId") Long orderId);

    public Integer checkedCount(@Param("userId") Long userId);

    List<YanchuOrderDetail> tickerVerification(@Param("sessionId") Long sessionId,
                                               @Param("keyName") String keyName,
                                               @Param("userId") Long userId, @Param("state") Integer state);

    List<ExcelOrderDetailVo> getExcelOrderDetailVO(@Param("array")List<Long> ids);
    List<ExcelOrderDetailVo> getExcelRefundOrderDetailVO(@Param("array")List<Long> ids);

    List<WatchRecordVo> selectWatchRecord(@Param("userId") Long userId, @Param("userinfoId") Long userinfoId, @Param("phone") String phone);
}
